import {checkUsernam,checkPassword }  from './utils.js'




 import './css/index.css'
 import './less/less.less'

 import imgobj from  './assets/logo.png'
 document.querySelector('.logo-img').src = imgobj

 const arr =[1,2,3,4,5]
 const newarr = arr.map(i=> i+1)

 import axios from 'axios'


 document.querySelector('.login-btn').addEventListener('click',()=>{
    const username = document.querySelector('.username').value
    
    const password = document.querySelector('.password').value
    
    if(!checkUsernam(username)){
        return alert("用户名错误")
       
    }
    if(!checkPassword(password)){
        return  alert("密码错误")
       
    }
    
    
    console.log('登录成功');

    axios({
        url:'http://ajax-api.itheima.net/register',
        method:'post',
        data:{
            username,
            password
        }
    }).then(res=> {
        alert(res.data.message)
    }).catch(err=>{
        alert(res.respon.data.message)
    })

    })

  console.lg(111);